#include <iostream>
#include <vector>
#include <queue>
#include <cstring>
#include <algorithm>
using namespace std;
#define maxn 40005
const int INF = 1<<30;

int n,m;
int bessie,elsie,together;
vector<int> G[maxn];
int dis[3][maxn];
bool visited[maxn];
int cntdis=0;
queue<int> que;
int minans=INF;
const int w = 1;

void SPFA(int s){
	for(int i=0;i<=n;i++) dis[cntdis][i]=INF;
	memset(visited,0,sizeof(visited));
	while(!que.empty()) que.pop();
	dis[cntdis][s]=0;
	visited[s]=true;
	que.push(s);
	while(!que.empty()){
		int u=que.front(); que.pop();
		visited[u]=false;
		for(auto v:G[u]){
			if(dis[cntdis][v]>dis[cntdis][u]+w){
				dis[cntdis][v]=dis[cntdis][u]+w;
				if(!visited[v]){
					que.push(v);
					visited[v]=true;
				}
			}
		}
	}
}

int main(){
	cin>>bessie>>elsie>>together>>n>>m;
	for(int i=0;i<m;i++){
		int u,v;
		cin>>u>>v;
		G[u].push_back(v);
		G[v].push_back(u);
	}

	SPFA(1); cntdis++;
	SPFA(2); cntdis++;
	SPFA(n); cntdis++;
	
	for(int mid=1;mid<=n;mid++){
		int cans = dis[0][mid]*bessie + dis[1][mid]*elsie + dis[2][mid]*together;
		minans = min(minans, cans);
	}
	
	cout<<minans<<endl;
	return 0;
}
